.TH std::expected::emplace 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::expected::emplace \- std::expected::emplace

.SH Synopsis
   T is not cv void
   template< class... Args >                                          \fB(1)\fP (since C++23)
   constexpr T& emplace( Args&&... args ) noexcept;
   template< class U, class... Args >
   constexpr T& emplace( std::initializer_list<U> il, Args&&... args  \fB(2)\fP (since C++23)
   ) noexcept;
   T is cv void
   constexpr void emplace() noexcept;                                 \fB(3)\fP (since C++23)

   Constructs an expected value in-place. After the call, has_value() returns true.

   1) Destroys the contained value, then initializes the expected value contained in
   *this as if by direct-initializing an object of type T from the arguments
   std::forward<Args>(args)....
   This overload participates in overload resolution only if
   std::is_nothrow_constructible_v<T, Args...> is true.
   2) Destroys the contained value, then initializes the expected value contained in
   *this as if by direct-initializing an object of type T from the arguments il and
   std::forward<Args>(args)....
   This overload participates in overload resolution only if
   std::is_nothrow_constructible_v<T, std::initializer_list<U>&, Args...> is true.
   3) If *this contains an unexpected value, destroys that value.

.SH Parameters

   args - the arguments to pass to the constructor
   il   - the initializer list to pass to the constructor

.SH Return value

   1,2) A reference to the new contained value.
   3) \fI(none)\fP

.SH Notes

   If the construction of T is potentially-throwing, this function is not defined. In
   this case, it is the responsibility of the user to create a temporary object and
   move or copy it.

.SH Example

    This section is incomplete
    Reason: no example

.SH See also

   operator= assigns contents
             \fI(public member function)\fP

.SH Category:
     * Todo no example
